/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.xtd.model.retail;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Lu Yuanbin
 */
@Entity
@Table(name = "account")
@NamedQueries({
    @NamedQuery(name = "Account.findAll", query = "SELECT a FROM Account a")})
public class Account implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private Integer id;
    @Column(name = "mname")
    private String mname;
    @Column(name = "mphone")
    private String mphone;
    @Column(name = "mbirthday")
    @Temporal(TemporalType.DATE)
    private Date mbirthday;
    @Column(name = "fname")
    private String fname;
    @Column(name = "fphone")
    private String fphone;
    @Column(name = "fbirthday")
    @Temporal(TemporalType.DATE)
    private Date fbirthday;
    @Column(name = "phone")
    private String phone;
    @Column(name = "company")
    private String company;
    @Column(name = "marriageDate")
    @Temporal(TemporalType.DATE)
    private Date marriageDate;
    @Column(name = "type")
    private String type;
    @Column(name = "address")
    private String address;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "account")
    private Collection<Lead> leadCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "account")
    private Collection<ShootingOrder> order1Collection;

    public Account() {
    }

    public boolean isNew() {
        if(id == null) {
            return true;
        } else {
            return false;
        }
    }

    public Account(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getMname() {
        return mname;
    }

    public void setMname(String mname) {
        this.mname = mname;
    }

    public String getMphone() {
        return mphone;
    }

    public void setMphone(String mphone) {
        this.mphone = mphone;
    }

    public Date getMbirthday() {
        return mbirthday;
    }

    public void setMbirthday(Date mbirthday) {
        this.mbirthday = mbirthday;
    }

    public String getFname() {
        return fname;
    }

    public void setFname(String fname) {
        this.fname = fname;
    }

    public String getFphone() {
        return fphone;
    }

    public void setFphone(String fphone) {
        this.fphone = fphone;
    }

    public Date getFbirthday() {
        return fbirthday;
    }

    public void setFbirthday(Date fbirthday) {
        this.fbirthday = fbirthday;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getCompany() {
        return company;
    }

    public void setCompany(String company) {
        this.company = company;
    }

    public Date getMarriageDate() {
        return marriageDate;
    }

    public void setMarriageDate(Date marriageDate) {
        this.marriageDate = marriageDate;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public Collection<Lead> getLeadCollection() {
        return leadCollection;
    }

    public void setLeadCollection(Collection<Lead> leadCollection) {
        this.leadCollection = leadCollection;
    }

    public Collection<ShootingOrder> getOrder1Collection() {
        return order1Collection;
    }

    public void setOrder1Collection(Collection<ShootingOrder> order1Collection) {
        this.order1Collection = order1Collection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Account)) {
            return false;
        }
        Account other = (Account) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.xtd.model.Account[id=" + id + "]";
    }
}
